//获取应用实例
const app = getApp();
// 引入AES.js
var baseJs = require("../../common/base.js");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    task1: [
      {
        value: "邀请注册",
        go: "邀请注册-->>",
        active: false,
        zero: "0",
        num: "",
        url: "/packageA/goInvite/goInvite"
      },
    ],
    // 月度任务
    uid: "",
    monthly: [],
    isFinishTargetOne: "",
    isFinishTargetTwo: "",
    isFinishTargetThree: "",
  },


  clickTo1: function () {
    wx.showModal({
      title: '提示',
      content: '每日任务每天都可以完成一次，月度任务每月仅能完成一次！完成任务后不要忘记领取奖励哟！',
      showCancel: false
    })
  },
  clickTo2: function () {
    wx.showModal({
      title: '提示',
      content: '下架商户、半冻结商户以及冻结商户将无法通过易易部落任务中心获得易码奖励！',
      showCancel: false
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    var uid = wx.getStorageSync('uid');
    this.setData({
      uid: wx.getStorageSync('uid'),
    })
    this.GetBuLuoTaskCenterInfo();

  },
  //  获取月度任务
  GetBuLuoTaskCenterInfo: function () {
    var that = this;
    var uid = this.data.uid;
    var monthly = this.data.monthly;
    var IsFinishTargetOne = this.data.IsFinishTargetOne;
    var IsFinishTargetTwo = this.data.IsFinishTargetTwo;
    var IsFinishTargetThree = this.data.IsFinishTargetThree;
    wx.request({
      url: baseJs.api + baseJs.encryUrl("method=GetBuLuoTaskCenterInfo&UID=" + uid),
      success: function (res) {
        console.log(JSON.parse(baseJs.decryUrl(res.data)));
        var monthly = JSON.parse(baseJs.decryUrl(res.data)).ResultData;
        // if (monthly.IsFinishTargetOne == 1){
        // }else{
        // }
        that.setData({
          monthly: monthly,
          IsFinishTargetOne: monthly.IsFinishTargetOne,
          IsFinishTargetTwo: monthly.IsFinishTargetTwo,
          IsFinishTargetThree: monthly.IsFinishTargetThree,
        })
        console.log(monthly);
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },


})